<template>
	<view class="container">
		<view class="item" v-for="(item, index) in list" :key="index" @click="handleClick(item)">
			<view><image class="item-image" :src="item.image"></image></view>
			<view class="item-1">
				<text class="item-text">{{ item.text }}</text>
				<br />
				<text class="item-teacher">{{ item.teacher }}</text>
				<view class=" item-price">
					<text class="item-details">{{ item.details}}</text>
					<text class="item-jiage">{{ item.time}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{
						id: 1,
						image: '/static/image/通知.png',
						text: '考试通知',
						teacher: '学习通知',
						details: '03-17',
						time: '13:47'
					},
					{
						id: 2,
						image: '/static/image/通知.png',
						text: '《高等数学（一）》',
						teacher: '陈鉴',
						details: '03-17',
						time: '08:45'
					},
				],
			};
		},
		methods: {
			handleClick(item) {
				console.log('Clicked:', item);
				// 跳转到详情页，并传递参数
				uni.navigateTo({
					url: `/pages/notice/notice?title=${encodeURIComponent(item.text)}&teachers=${encodeURIComponent(item.teacher)}&detail=${encodeURIComponent(item.details)}`
				});
			},
		},
	};
</script>

<style>
	.container {
		height: 850px;
		background-color: white;
		/* background: linear-gradient(to top, whitesmoke, lightcyan); */
	}

	.item {
		display: flex;
		align-items: center;
		background-color: white;
		box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2);
		margin-top: 10rpx;
		margin-left: 5px;
		width: 97%;
		height: 90px;
		border-radius: 2px;
	}

	.item-image {
		width: 65px;
		height: 65px;
		border-radius: 8px;
		margin-left: 15px;
		display: flex;
		align-items: center;
	}

	.item-1 {
		flex: 1;
		padding: 20px;
	}

	.item-text {
		font-size: 18px;
		color: #333;
	}

	.item-teacher {
		color: gray;
	}

	.item-price {
		margin-top: 10px;
	}
	.item-jiage {
		color: gray;
		margin-left: 10px;
	}
</style>
